<?php 
	$username = $_SESSION['username'];    $query = "select * from user where username='$username'";    $result = mysql_query($query);
	$user = mysql_fetch_array($result);
		$gamecode = $user['gamecode']; 
		if (empty($gamecode)) { include 'gamecode.php'; exit();};
?>
<table height="320px" width="603px" >
				<tr><td id="info" valign="top">
					<table cellpadding="0" cellspacing="0" >
						<tr><td width="395px" valign="top">
						<?php include 'navbar.php'; ?>
						</td>
						<td>&nbsp;</td>
						<td valign="top">
							<table cellpadding="0" cellspacing="0" border="0" align="right" width="185px"><tr><td><?php include 'usergreet.php'; ?>
							</td></tr><tr><td id="login"><div align="right"><span style="font-size:12px"><? echo $user['nick']; ?></span> ( <strong><a href="index.php?act=logout">Logout</a></strong> )</div></td></tr></table>
					

						</td></tr>
					</table>

					<table cellpadding="0" cellspacing="0"><tr><td width="385px" valign="top">
					<div align="left"><h3>setup a match for the evening</h3>								<span style="font-size:10px">Time is displayed in <a href="http://www.google.com/search?q=what+time+is+it">Central Standard Time (CDT)</a>
						<p /><?php 					
									if (!isset($_POST['submit'])) {     									include 'createroom_form.inc.php';									}
else							{

								if (empty($_POST['roomname']))								{									$createroom_error = 'room name, please...';
									$error = '1';          							include 'createroom_form.inc.php';								}

								if (empty($createroom_error)) {									create_room($_POST['roomname'], $_POST['desc'], $_POST['skill'], $_POST['racing'], $user['username'], $_POST['time']); echo '<h3>Thanks and your match has been set up</h3>'; echo '<script>							<!-- 								 window.location= "http://www.mariokartchallenger.com/index.php?act=game"							//-->							</script>'; } else {$error='0'; $createroom_error='';}							}
							 ?></span></td><td valign="top">
						<?php include 'sidebar.php' ?>					
					</td>

					</tr></table>
				
					</td></tr>
			</table>
			</td>
		</tr>
	</table>
<?php include 'footer.php'; ?>
